-
Notifications
You must be signed in to change notification settings - Fork 180
[CIR] Record type constraints #1834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
xlauko
wants to merge
2,598
commits into
main
Choose a base branch
from
users/xlauko/cir-record-type-constraints
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
+161,633
−44,742
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ity and maintainability (#1525) As noted in [this comment](#1442 (comment)), the nested if-arms in `GlobalOpLowering` are somewhat confusing and error-prone. This PR simplifies the logic into more straightforward components. Since LLVM's GlobalOp accepts two types of initializers (either an initializer value or an initializer region), we've extracted the decision logic into a separate function called `lowerInitializer`. This function takes two inout arguments: `mlir::Attribute &init` (for the attribute value) and `bool useInitializerRegion` (as the decision indicator). All code paths then converge at a common epilogue that handles the operation rewriting. The previous implementation for lowering `DataMemberAttr` initializers relied on recursion between MLIR rewrite calls, which made the control flow somewhat opaque. The new version makes this explicit by using a clear self-recursive pattern within `lowerInitializer`.
Fix #1371. Not sure about whether we could remove `convertTypeForMem` completely. Let's fix the doc first.
This change moves all declarations of emit* functions in CIRGenFunction.h into a common location and sorts them alphabetically. The goal of this change is to make it easier to keep upstream and incubator code in a consistent location, making functions easier to find for upstreaming and minimizing conflicts in the incubator when rebasing. I did most of this sort manually, and I've probably been inconsistent in how I treat sorting of uppercase versus lowercase. I made no attempt to provide a rule for ordering different declarations of functions with the same name. We can improve on that over time if anyone feels the need. I tried very hard not to drop comments (one of the reasons I had to do this manually), but I may have lost a few. This change loses the grouping of some declarations that were co-located by common purpose, but most of the declarations lacked a coherent ordering, so I think this is a step forward overall.
This is a rebased version of the inactive PR #1380. --------- Co-authored-by: koparasy <[email protected]>
Adds implementation for ATanOp's lowering ThroughMLIR.
Lower `vabds_f32` and `vabdd_f64`
Adds implementation for ACosOp's lowering ThroughMLIR.
Lower vmaxv_s32
Adds implementation for ASinOp's lowering ThroughMLIR.
Lower vmaxv_u32
Lower vmaxvq_f64
Lower vmaxnmvq f32 and f64
In the review for upstreaming unary operation support (llvm/llvm-project#131369), it was suggested that the VisitPlus and VisitMinus functions should be combined. This is a backport of that refactoring.
This also removes some unused `#include`s. I choose to allow lowering to LLVM dialect when we're lowering CIR to MLIR core dialects, because some operations don't have their counterparts in these dialects (for example, `UnreachableOp -> llvm.unreachable` and `LLVMIntrinsicCallOp -> cir.llvm.intr.xxx`). I don't think we can delay them to the MLIR->LLVM pass as it seems we assume all CIR operations have been lowered after CIR->MLIR conversion. Co-authored-by: Yue Huang <[email protected]>
Lower vmaxnmv_f32
Update getZeroInitAttr to cover more FP types, Backport from (llvm/llvm-project#133100)
Adds implementation for TanOp's lowering via ThroughMLIR.
Upstream commit changed behavior llvm/llvm-project@ff585fe I tested in original clang and it produced the same IR with clangir. Related: #1497
…nmvq_f32 (#1546) ower vminnmv_f32, vminnmvq_f64 and vminnmvq_f32
…#1547) When a pointer variable is initialized with a null pointer, the AST contains a NullToPointer cast. If we just emit a null pointer of the correct type, we will miss any side effects that occur in the initializer. This change adds code to emit the initializer expression if it is not a simple constant. This results in an extra null pointer constant being emitted when the expression has side effects, but the constant emitted while visiting the expression does not have the correct type, so the alternative would be to capture the emitted constant and bitcast it to the correct type. An extra constant seems less intrusive than an unnecessary bitcast.
Lower vminv_s32
Lower vminv_u32
#1552) These entries exist in OG but are not present in CIR codegen.
Added: - `cos` - `floor` - `round` - `rint` - `nearbyint` - `sin` - `sqrt` - `tan` - `trunc`
Lower vminvq_f32 and vminvq_f64
Special handling for array of unions was forcing all non-union C arrays to be emitted as CIR arrays, which differs from OG CodeGen, where array may be emitted as LLVM struct. Closes #1315
We were missing argument handling for `-fclangir-idiom-recognizer` on its own, and were not propagating `-fclangir-lib-opt` for the clang toolchain.
Failure: ``` calling convention does not permit calls call spir_kernel void @bar(ptr addrspace(1) %10) fatal error: error in backend: Lowering from LLVMIR dialect to llvm IR failed! ```
This makes it on par with OG but does not add anything just yet (same NYI asserts should fail).
This will enable handling for records (coming next)
This includes member data attribute in to enable and existing test. LLVM lowering is follow up work. Fixes XFAIL in ../clang/test/CIR/CodeGen/nonzeroinit-struct.cpp
This PR is inspired by the discussion in #1745 (comment). When changing the type of ```mlir IndexAttr:$index, I64Attr:$index ``` in `GetMemberOp`, the `getIndex` method becomes auto-generated. This allows us to remove the custom builder previously defined for this operation.
Backport AbstractConditionalOperator for ComplexType from the upstream Fix: #1788
Previously, when an array of destructible object went out of scope, the object destructors were called in the same order that they were constructed. This is incorrect. The objects should be destructed in reverse order. This change fixes that. This fixes #1759
Backport LValueBitcast support for ComplexType from the upstream
8acaf96 to
58135ea
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

No description provided.